#region Imports
using System.Windows;
using System.Windows.Controls;
#endregion

namespace JounceSilverlightDemo
{
    public partial class App
    {
        #region Variable Declaration
        private static Grid root;
        #endregion

        public App()
        {
            this.Startup += this.Application_Startup;
            InitializeComponent();
        }

        private void Application_Startup(object sender, StartupEventArgs e)
        {
            root = new Grid();
            root.Children.Add(new MainPage());
            this.RootVisual = root;
        }

        /// <summary>
        /// Navigation 
        /// </summary>
        /// <param name="newPage"></param>
        public static void Navigate(UserControl newPage)
        {
            UserControl oldPage = root.Children[0] as UserControl;
            root.Children.Add(newPage);
            root.Children.Remove(oldPage);
        }
    }
}
